function getFilteredFTContent() {
	var documents:java.util.Vector = new java.util.Vector();
	var itemView:NotesView = database.getView("$v-filter");
	var searchQuery:string = getSearchQuery();	
	itemView.clear();
	if (searchQuery != ""){
		if (searchQuery != undefined) {
			
			
			itemView.FTSearch(searchQuery,0)
		}
	}
	var viewEntryCol:NotesViewEntryCollection = itemView.getAllEntries();
	var viewEntry:NotesViewEntry = viewEntryCol.getFirstEntry();	
	while (viewEntry != null) {
		var doc:NotesDocument = viewEntry.getDocument();
		documents.addElement(doc);
		viewEntry = viewEntryCol.getNextEntry(viewEntry);		
	}
	return documents;	
}

function getSearchQuery() {	
	var str:string = "";

	var selectedFilter1 = new Array();
	selectedFilter1 = getComponent("filtercategory").getValue();

	checkvalue = selectedFilter1 ;
	if (checkvalue != null ){
		for (var i = 0; i < selectedFilter1.length; i++) {
			if (i == 0) {
				str += "FIELD Photo_Category CONTAINS \"" + selectedFilter1[i] + "\"";
			} else {
				str += " OR FIELD Photo_Category CONTAINS \"" + selectedFilter1[i] + "\""  ;
			}		
		}	
		if (selectedFilter1.length != 0){
			str = "(" + str.trim() + ")"
			str = " AND " + str
		}	
		
	}
	
	var str2:string = "";
	var selectedFilter2 = new Array();
	selectedFilter2 = getComponent("filtertag").getValue();
	
	checkvalue = selectedFilter2 ;
	if (checkvalue != null ){
		//var selectedFilter = selectedFilter.concat(selectedFilter2);
		
		if (selectedFilter2.length > 0){
			
			for (var i = 0; i < selectedFilter2.length; i++) {
				if (i == 0) {
					str2 += "FIELD Photo_Tags CONTAINS \"" + selectedFilter2[i] + "\"";
				} else {
					str2 += " OR FIELD Photo_Tags CONTAINS \"" + selectedFilter2[i] + "\""  ;
				}		
			}
		
			if (selectedFilter2.length > 0){
						str2 = "(" + str2.trim() + ")"
 			}
 			
 			str2 = " AND " + str2
		}		
	}
	
	var str3:string = "";
	var selectedFilter3 = new Array();
	selectedFilter3 = getComponent("filterlocation").getValue();
	
	checkvalue = selectedFilter3 ;
	if (checkvalue != null ){
		//var selectedFilter = selectedFilter.concat(selectedFilter2);
		
		if (selectedFilter3.length > 0){
			
			for (var i = 0; i < selectedFilter3.length; i++) {
				if (i == 0) {
					str3 += "FIELD Photo_Country CONTAINS \"" + selectedFilter3[i] + "\"";
				} else {
					str3 += " OR FIELD Photo_Country CONTAINS \"" + selectedFilter3[i] + "\""  ;
				}		
			}
		
			if (selectedFilter3.length > 0){
						str3 = "(" + str3.trim() + ")"
 			}
 			
 			str3 = " AND " + str3
		}		
	}
	
	var str4:string = "";
	var selectedFilter4 = new Array();
	selectedFilter4 = getComponent("filterdate").getValue();
	
	checkvalue = selectedFilter4 ;
	if (checkvalue != null ){
		//var selectedFilter = selectedFilter.concat(selectedFilter2);
		
		if (selectedFilter4.length > 0){
			
			for (var i = 0; i < selectedFilter4.length; i++) {
				if (i == 0) {
					str4 += "FIELD Tx_Creation CONTAINS \"" + selectedFilter4[i] + "\"";
				} else {
					str4 += " OR FIELD Tx_Creation CONTAINS \"" + selectedFilter4[i] + "\""  ;
				}		
			}
		
			if (selectedFilter4.length > 0){
						str4 = "(" + str4.trim() + ")"
 			}
 			
 			str4 = " AND " + str4
		}		
	}
	
	var str5:string = "";
	var selectedFilter5 = new Array();
	selectedFilter5 = getComponent("filterphotographer").getValue();
	
	checkvalue = selectedFilter5 ;
	if (checkvalue != null ){
		//var selectedFilter = selectedFilter.concat(selectedFilter2);
		
		if (selectedFilter5.length > 0){
			
			for (var i = 0; i < selectedFilter5.length; i++) {
				if (i == 0) {
					str5 += "FIELD Au_Author CONTAINS \"" + selectedFilter5[i] + "\"";
				} else {
					str5 += " OR FIELD Au_Author CONTAINS \"" + selectedFilter5[i] + "\""  ;
				}		
			}
		
			if (selectedFilter5.length > 0){
						str5 = "(" + str5.trim() + ")"
 			}
 			
 			str5 = " AND " + str5
		}		
	}
	
	
	
	//return str + str2
		return @Right(str + str2 + str3 + str4 + str5,"AND");
		//return selectedFilter1.length + " "
	
}